import json


try:
    with open('./names.txt', 'w') as fo:
        json.dump("{'age': '12'}", fo)
    with open('./names.txt', 'r') as fo:
        content = json.load(fo)
        print(content)
except Exception as e:
    print(e)
    print('error')
else:
    print('success!')
